package com.ppw.ssmdemo.controller;

import com.ppw.ssmdemo.dao.UserMapper;
import com.ppw.ssmdemo.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {
    @Autowired
    private UserMapper userMapper;

    @RequestMapping("/user/getUserByName")
    public String getUserByName(HttpServletRequest request) {
        User user = userMapper.selectUserByName("zhangsan");
        request.setAttribute("user", user);
        return "index";
    }
}
